//
//  ViewController.m
//  CIrcleChangeTransition
//
//  Created by Chenbo on 16/6/24.
//  Copyright © 2016年 北京数字天域科技有限公司. All rights reserved.
//

#import "ViewController.h"
#import "NextViewController.h"
#import "CircleTransitioner.h"

@interface ViewController ()<UIViewControllerTransitioningDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    _firstBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
    _firstBtn.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height - 50);
    [_firstBtn setBackgroundColor:[UIColor greenColor]];
    _firstBtn.clipsToBounds = YES;
    _firstBtn.layer.cornerRadius = 50 / 2;
    [_firstBtn addTarget:self action:@selector(present) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_firstBtn];
}
- (void) present {
    NextViewController *next = [[NextViewController alloc] init];
    next.transitioningDelegate = self;
    [self presentViewController:next animated:YES completion:nil];
}
- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
    CircleTransitioner *transitioner = [[CircleTransitioner alloc] init] ;
    transitioner.presenting = YES;
    return transitioner;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
